<script>
import BaseChart from './BaseChart.vue';

export default {
  extends: BaseChart,
  name: 'BarChart',
  data() {
    return {
      series: [{
        type: 'bar'
      }],
      xAxis: {
        type: this.xAxisType,
      },
    }
  },
  props: {
    xAxisType: {
      type: String,
      default: 'category'
    }
  },
  computed: {
    yAxisType: function () {
      return this.xAxisType === 'category' ? "value" : "category"
    }
  },
  created() {
    this.setOption("series", this.series);
    this.setOption("xAxis", this.xAxis);
    this.setOption("yAxis", {type: this.yAxisType});
  }
}
</script>
